home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Texto y fuentes / FontSizes / FontSizes.cs next >
Encoding:
Text File  |  2002-04-24  |  952 b   |  33 lines

  1. //----------------------------------------
  2. // FontSizes.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class FontSizes: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new FontSizes());
  13.      }
  14.      public FontSizes()
  15.      {
  16.           Text = "Tama±os de fuente";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  19.      {    
  20.           string strFont = "Times New Roman";
  21.           Brush  brush   = new SolidBrush(clr);
  22.           float  y       = 0;
  23.  
  24.           for (float fSize = 6; fSize <= 12; fSize += 0.25f)
  25.           {
  26.                Font font = new Font(strFont, fSize);
  27.                grfx.DrawString(strFont + " con " + fSize + " puntos", 
  28.                                font, brush, 0, y);
  29.                y += font.GetHeight(grfx);
  30.           }
  31.      }
  32. }
  33.